<template>
	<view class="page-index">
		<view class="bar-area">
			<view class="fc-white fs30" @click="loginOut" :style="showQuitBtn?'':'visibility: hidden;'">退出</view>
			<view class="flex-row" @click="areaChange">
                <view class="fc-white fs35">皮试执行</view>
            </view>
			<view class="fc-white fs30">{{ loginUser && loginUser.YHXM }}</view>
		</view>
        <view class="patient-info" v-if="step != 0">
            <view class="item-title">
                <view class="item-brch">{{ nowPatient.brch }}</view>
                <view class="item-info">
                    <view class="item-line"></view>
                    <view class="item-body">
                    <view class="item-body-top">
                        <view class="fs30 fb">{{ nowPatient.brxm }}</view>
                            <u--image
                                class="ml10"
                                width="20"
                                height="20"
                                :src="
                                nowPatient.brxbDm == 1 ? '/static/man.svg'
                                        : '/static/female.svg'
                                "
                            ></u--image>
                            <view class="fs30 fc-sub ml10">{{nowPatient.brnl}}</view>
                            <view class="fs30 fc-sub ml10">{{nowPatient.mzhm}}</view>
                        </view>
                    </view>
                </view>
            </view>
            <view class="patientInfo-zd">
                诊断：{{nowPatient.brzs}}
            </view>
			<view class="filter-button" @click="handleExecuteFilter()">{{executeFilter == 2?'已完成':'未完成'}}</view>
        </view>
		<view class="scan-tips-warning " v-if="step == 0"> 请扫描病人腕带进行确认 </view>
        <!-- <view class="scan-tips-warning " v-if="step == 1"> 请扫描输液贴 </view> -->
        <view class="scan-tips-primary" v-if="step == 1"> 已确认病人腕带信息 </view>
		<view class="scan-tips-warning " v-if="step == 2"> 请再确认患者腕带信息 </view>



		<!-- <view style="display:flex;position:absolute;top:0rpx;left:100rpx;">
			<view>
				<view @click="scanTest(testBrid,1)">腕带扫描测试</view>
				<view @click="scanTest(testIdMedordipex,2)">输液贴扫描测试</view>
			</view>
			<view>
				<input type="text" v-model="testBrid" placeholder="请输入病人id">
				<input type="text" v-model="testIdMedordipex" placeholder="请输入医嘱计划id">
			</view>
			<view>
				<view @click="showDoubleCheck = true">提交结果弹窗</view>
			</view>
			<view>
				<view @click="handleNotify">震动响铃</view>
			</view>
		</view> -->
		


		<!--  -->
        <view class="main-context" v-if='step != 0'>
            <!-- <u-tabs :list="tabList" :is-scroll="false" :current="currentTab" @change="tabChange"></u-tabs> -->
            <scroll-view
                class="scroll-view"
                scroll-y="auto"
                :refresher-enabled="false"
                @refresherrefresh="onPullRefresh"
                @scrolltolower="onReachBottomDistance"
                :refresher-triggered="isRefresherTriggered"
            >
                <view>
					 <!-- v-for="(item, index) in listData" :key="index" -->
                    <view
                        class="item-area" 
                       	v-for="(item, index) in listData" :key="index"
						:style="item.skinTestScaned == 1?'background-color:#E9F8EB;':''"
                    >
						<view class="isExecute" v-if="item.skinTestScaned == 1">
							<!-- <span class="my-icon">√</span> -->
							<view class="my-icon">
								<u-icon color="#FFFFFF" name="checkbox-mark"></u-icon>
							</view>
							
						</view>
                        <!-- <view class=""> -->
                            <!-- 医嘱区域 -->
                            <view class="item-content">
                                <view class="item-content-icon">药</view>
                                <view class="item-content-list">
                                    <view class="list-item">
                                        <view class="item-name">{{item.naSrvMed}}</view>
                                        <!-- <view class="item-amount">500ml</view> -->
                                    </view>
                                </view>
                            </view>
                            <view class="item-bottom">
                                <!-- 计划时间 -->
                                <view class="plan-datetime">
									<span v-if="executeFilter == 1">开嘱时间：{{item.dtMedordActiveStr}}</span>
                                    <span v-if="executeFilter == 2">皮试时间：{{item.updateTimeStr}}</span>
                                </view>
                                <view class="item-check-status" v-if="item.skinTestScaned == 0 && executeFilter == 1">
                                    未执行
                                </view>
								<view class="item-check-status" v-if="item.skinTestScaned == 1 && executeFilter == 1">
                                    录入结果
                                </view>
                            </view>
                        <!-- </view> -->
                    </view>
                
                    <u-empty
                        :show="!(listData && listData.length > 0)"
                        marginTop="300"
                    ></u-empty>
                </view>
            </scroll-view>
        </view>

		<!-- 开始皮试 - 输入批号 -->
        <u-popup :show="showSkinTestStart" closeable @close="handleSkinTestStartClose()">
            <view class="double-check">
                <view class="double-check-title">开始皮试</view>
                <view class="double-check-form-item">
                    <view class="double-check-form-item-label">皮试批号：</view>
                    <view class="double-check-form-item-input">
                        <u-input v-model="nowNumSkin" type="text"
                        placeholder="选填" clearable/>
                    </view>
                </view>
                <view class="submit-button">
                    <button @click="handleSkinTestStartSubmit()">开始皮试</button>
                </view>
            </view>
        </u-popup>

		<!-- 录入结果 -->
        <u-popup :show="showDoubleCheck" closeable @close="handleDoubleCheckClose()">
            <view class="double-check">
                <view class="double-check-title">录入结果</view>
				<view class="double-check-form-item">
                    <view class="double-check-form-item-label">皮试结果：</view>
                    <view class="double-check-form-item-input">
                        <u-radio-group
							v-model="doubleCheckForm.skinResult"
							placement="column"
						>
							<u-radio
								:customStyle="{marginBottom: '8px'}"
								v-for="(item, index) in radiolist1"
								:key="index"
								:label="item.name"
								:name="item.name"
							>
							</u-radio>
						</u-radio-group>
                    </view>
                </view>
				
                <view class="double-check-form-item">
                    <view class="double-check-form-item-label">护士用户名：</view>
                    <view class="double-check-form-item-input">
                        <u-input v-model="doubleCheckForm.userName" type="text"
                        placeholder="请输入用户名" clearable/>
                    </view>
                </view>
                <view class="double-check-form-item">
                    <view class="double-check-form-item-label">护士密码：</view>
                    <view class="double-check-form-item-input">
                        <u-input v-model="doubleCheckForm.password" type="password" 
                        placeholder="请输入密码" clearable/>
                    </view>
                </view>
                <view class="submit-button">
                    <button @click="handleDoubleCheckSubmit()">提交结果</button>
                </view>
            </view>
        </u-popup>
	</view>
</template>

<script>
import { mapState } from "vuex"
import { logout } from "@/api/utils.js"
import { 
	getDateTimeString,
	getAdviceType,
	getPlanStatus,
	getTimestamp,
	showToast,
} from "@/static/js/common.js"
// import plus from "uni-app-plus"

export default {
	components: {},
	props: {
		showQuitBtn: {
			type: Boolean,
			default:function () {
				return true
			}
		},
	},
	data() {
		return {
			step:0,// 0:初始化空白状态  1:已扫描腕带  2:已扫描输液贴

			isRefresherTriggered: false,

            showDoubleCheck:false,//二次核对弹框

            doubleCheckForm:{
                userName:null,//护士用户名
                password:null,//护士密码
				userId:null,//用户id
				skinResult: '阴性',//皮试结果 默认阴性
            },

			listData: [],// 医嘱计划处理后的数据
			nowPatient:{},// 当前病人
			nowIdVismed:'',//当前患者的就诊流程号
			nowIdMedord:'',//当前扫描出来的组号

			nowSkinTest:{},//当前皮试信息

			executeFilter:1,// 1：未完成 2：已完成

			radiolist1: [
				{
					name: '阴性',
				},
				{
					name: '阳性',
				},
				// {
				// 	name: '免皮试',
				// }
          	],
			
			showSkinTestStart:false,//皮试开始弹窗
			nowNumSkin:'',//皮试批号

			skinTestInterval:null,//皮试计时器
			skinCompleteTipsShow:false,
			skinCompleteTipsTitle:'提醒',
			skinCompleteTipsContent:[],//已完成皮试的病人

			testBrid:'',//
			testIdMedordipex:'',//
		}
	},
	watch: {
		
	},
	computed: {
		...mapState(["loginUser", "area","skinTestPatientList"]),
		actions() {
			if (this.area && this.area.length > 0) {
				let list = this.area.map((item) => {
					return {
						name: item.ksmc,
						code: item.ksdm,
					}
				})
				return list
			} else {
				return []
			}
		},
		numberOfSkinNotComplete(){
			let number = 0;
			for(let i=0;i<this.listData.length;i++){
				if(this.listData[i].dtStartSign){
					number++;
				}
			}
			return number;
		}
	},
	beforeDestroy(){
		uni.$off('scanCodeEmit');//取消监听
	},
	mounted() {
		// 接收原生扫描传值     监听扫描事件
		uni.$on("scanCodeEmit", async (res) => {
			console.log("皮试扫描内容：", res)
			// uni.$emit("scanCodeEmit", res)

			if (res.indexOf("嘱") != -1) {//是医嘱
				if(this.step != 1){// 没有扫描腕带
					showToast(-1,'请先扫描患者腕带');
					return;
				}
				let idMedordipex = res // 获取到输液贴二维码上的医嘱计划号
				let idMedordRes = await this.getIdMedord(idMedordipex);
				let idMedord;
				if(idMedordRes.res.Data.length > 0){
					idMedord = idMedordRes.res.Data[0].hihisAdvicePlanBeanList[0].idMedord;
				}else{
					showToast(-1,'未找到医嘱计划信息');
					return;
				}
				console.log('医嘱组号：',idMedord);
				let patientRes = await this.getPatientByIdMedord(idMedord);
				console.log('病人response：',patientRes);
				if(patientRes.res.Data[0].hisJzxh != this.nowPatient.hisJzxh){
					showToast(-1,'输液贴不属于当前病人');
					return;
				}

				// this.step = 2;//已扫描输液贴

				let skinItem = this.listData.find(el=>el.idMedord == idMedord);//列表数据中查询皮试
				if(skinItem){
					if(this.executeFilter == 2){//已完成列表
						showToast(-1,'此皮试已完成');
						return;
					}else if(this.executeFilter == 1){//未完成列表
						if(skinItem.dtStartSign){//皮试已开始
							this.nowSkinTest = skinItem;//暂存当前医嘱
							this.showDoubleCheck = true;//打开结果录入弹窗
						}else{//皮试未开始
							if(this.numberOfSkinNotComplete > 0){//先判断是否有未录入结果的皮试
								showToast(-1,'存在未录入结果的皮试');
								return;
							}
							this.nowSkinTest = skinItem;//暂存当前医嘱
							//调用皮试扫描执行接口
							this.nowNumSkin = '';//皮试批号置空
							// this.showSkinTestStart = true;//打开皮试弹窗
							this.handleSkinTestStartSubmit();//皮试开始
						}
					}
				}else{
					showToast(-1,'未找到皮试信息');
					return;
				}
			}else{//是腕带
				// this.executeFilter = 1;//筛选未执行数据
				let patientRes = await this.getPatientByBrid(res);
				if(patientRes.res.Data.length == 0){
					showToast(-1,'没有找到病人信息');
					return;
				}
				this.nowPatient = patientRes.res.Data[0];//获取病人信息
				await this.getSkinListByMzhm(this.nowPatient.mzhm);
				this.step = 1;//当前已扫描腕带
			}
		})
		
		this.setSkinTestInterval();//设置皮试定时器
		
		console.log("当前登陆人信息：", this.loginUser);
	},
	methods: {

		/**
		 * 扫描测试
		 * type 1 腕带   2 输液贴
		 */
		async scanTest(res,type){
			if(type == 1){
				// this.executeFilter = 1;//筛选未执行数据
				let patientRes = await this.getPatientByBrid(res);
				if(patientRes.res.Data.length == 0){
					showToast(-1,'没有找到病人信息');
					return;
				}
				this.nowPatient = patientRes.res.Data[0];//获取病人信息
				await this.getSkinListByMzhm(this.nowPatient.mzhm);
				this.step = 1;//当前已扫描腕带
			}else if(type == 2){
				if(this.step != 1){// 没有扫描腕带
					showToast(-1,'请先扫描患者腕带');
					return;
				}
				let idMedordipex = res // 获取到输液贴二维码上的医嘱计划号
				let idMedordRes = await this.getIdMedord(idMedordipex);
				let idMedord;
				if(idMedordRes.res.Data.length > 0){
					idMedord = idMedordRes.res.Data[0].hihisAdvicePlanBeanList[0].idMedord;
				}else{
					showToast(-1,'未找到医嘱计划信息');
					return;
				}
				console.log('医嘱组号：',idMedord);
				let patientRes = await this.getPatientByIdMedord(idMedord);
				console.log('病人response：',patientRes);
				if(patientRes.res.Data[0].hisJzxh != this.nowPatient.hisJzxh){
					showToast(-1,'输液贴不属于当前病人');
					return;
				}

				// this.step = 2;//已扫描输液贴

				let skinItem = this.listData.find(el=>el.idMedord == idMedord);//列表数据中查询皮试
				if(skinItem){
					if(this.executeFilter == 2){//已完成列表
						showToast(-1,'此皮试已完成');
						return;
					}else if(this.executeFilter == 1){//未完成列表
						if(skinItem.dtStartSign){//皮试已开始
							this.nowSkinTest = skinItem;//暂存当前医嘱
							this.showDoubleCheck = true;//打开结果录入弹窗
						}else{//皮试未开始
							if(this.numberOfSkinNotComplete > 0){//先判断是否有未录入结果的皮试
								showToast(-1,'存在未录入结果的皮试');
								return;
							}
							this.nowSkinTest = skinItem;//暂存当前医嘱
							//调用皮试扫描执行接口
							this.nowNumSkin = '';//皮试批号置空
							// this.showSkinTestStart = true;//打开皮试弹窗
							this.handleSkinTestStartSubmit();//皮试开始
						}
					}
				}else{
					showToast(-1,'未找到皮试信息');
					return;
				}
			}
		},
		//调用父组件 震动响铃
		handleNotify(){
			this.$emit('handleNotify');
		},
		/**
		 * 获取医嘱组号
		 * idMedordipex 医嘱计划id
		 */
		getIdMedord(idMedordipex) {
			let params = {
				idMedord: null, //string 输液贴id - 对应pc端医嘱执行模块的医嘱组号
				adviceServiceType: 4, //number 1：核对模块 2 配药模块 3 执行 4：皮试执行
				jgid: this.loginUser.JZJGID, //短机构id
				ksid: this.loginUser.KSID, //科室id
				orgId: this.loginUser.JGID, //长机构id
				yhdm: this.loginUser.YHDM, //用户代码
				beginTime: null, //开始时间
				endTime: null, //结束时间
				idMedordipex: idMedordipex, //执行计划id
				idVismed: this.nowPatient.hisJzxh, //就诊流程号|his就诊序号 ,
				isShowST: 1, //是否展示皮试医嘱控制 0 否 1 是 ,
				isOnlyST: 1, //是否只展示皮试医嘱
				jzfq: null, //急诊分区
				jzlc: null, //就诊流程 默认值112 急诊 ,
				uid: this.loginUser.YHID, //当前登录人id ,
				yzlx: null, //医嘱类型  1开头：药品| 21开头： 检查| 22开头： 检验 |23开头： 手术 |24 开头：治疗 |25开头： 护理 |26开头： 嘱托 |27开头： 诊疗 ,
				yzqx: null, //医嘱期效益 ,
				yzzt: null, //1:已核对 2 已配药 3 已执行 4 未执行(未核对|未配药|未执行)
			}

			return this.$commonAjax(
				"auth/mobile/advice/get/GetPlanList",
				params
			)
		},
		/**
		 * 设置皮试定时器
		 */
		setSkinTestInterval(){
			this.$emit('setSkinTestInterval');//父组件创建皮试定时器
		},

		/**
		 * 皮试开始
		 */
		handleSkinTestStartSubmit(){
			this.handleScanSkin();//调用皮试开始接口
		},

		/**
		 * 皮试弹窗关闭回调
		 */
		handleSkinTestStartClose(){
			this.nowNumSkin = '';
			this.showSkinTestStart = false;
		},

		/**
		 * 皮试结果提交
		 * planList 医嘱计划组
		 */
		async handleSkinTestResultSubmit() {
			let date = new Date();
			let params={
				// cancel: false,
				// dtSkintest: getDateTimeString(date),//皮试录入时间
				// functionId: null,
				// idEmpSign: this.doubleCheckForm.userId,//双签人
				// idEmpSkintest: this.loginUser.YHID,//皮试录入人
				idMedord: this.nowSkinTest.idMedord,//医嘱id
				// pass: this.doubleCheckForm.skinResult == '免皮试'?1:null,
				sdResultCd: this.doubleCheckForm.skinResult == '免皮试'?null:(this.doubleCheckForm.skinResult == '阴性'?2:1),
				userName:this.doubleCheckForm.userName,//账号
				passWord:this.doubleCheckForm.password,//密码
			}
			return this.$commonAjax(
				"auth/mobile/advice/adviceskintest/scanEcisaddSkintestResult",
				params
			).then(res=>{
				if(res.res.ReType == 0){
					showToast(res.res.ReType,'录入成功');
					this.step = 1;
					this.showDoubleCheck = false;//关闭二次确认弹窗
					this.doubleCheckForm = {
						userName:null,//护士用户名
						password:null,//护士密码
						userId:null,//用户id
						skinResult: '阴性',//皮试结果 默认阴性
					}
					this.$store.commit("deleteSkinTestPatient", {//将患者从皮试队列中删除
						idVismed:this.nowPatient.hisJzxh,
					});
					this.setSkinTestInterval();//重新设置皮试计时
					setTimeout(()=>{
						this.getSkinListByMzhm(this.nowPatient.mzhm);
					},1500)
				}else{
					showToast(-1,res.res.Msg);
				}
			})
		},

		/**
		 * 皮试扫描
		 */
		handleScanSkin(){
			let date = new Date();
			let params = {
				dtStartSign: getTimestamp(date),//开始时间
				idMedord: this.nowSkinTest.idMedord,//医嘱组号
				numSkin: this.nowNumSkin,//皮试批号
			}
			return this.$commonAjax(
				"auth/mobile/advice/adviceskintest/scanEcissaveNumSkinAndStartSkinTest",
				params
			).then(res=>{
				if(res.res.ReType == 0){
					showToast(res.res.ReType,'皮试成功');
					// this.step = 2;
					// this.showSkinTestStart = false,//关闭皮试弹窗
					setTimeout(()=>{
						this.getSkinListByMzhm(this.nowPatient.mzhm);//刷新列表
					},1500);

					//患者加入皮试队列
					let skinTestPatient =  {
						brxm:this.nowPatient.brxm,//病人姓名
						mzhm:this.nowPatient.mzhm,// 病案号
						idVismed:this.nowPatient.hisJzxh,// 就诊流程号
						idMedord:this.nowSkinTest.idMedord,// 医嘱组号
						naSrvMed:nowSkinTest.naSrvMed,//药品名称
						quanSkintestLimit:this.nowSkinTest.quanSkintestLimit,// 皮试时间  分钟
						startTime:getTimestamp(date),// 开始时间  时间戳
						shouldEndTime:getTimestamp(date) + Number(this.nowSkinTest.quanSkintestLimit) * 60 * 1000,// 应当结束的时间  时间戳
						// shouldEndTime:getTimestamp(date) + 10 * 1000,// 测试 应当结束的时间  时间戳   
					}
					this.$store.commit("addSkinTestPatient", skinTestPatient);
					this.setSkinTestInterval();//开始皮试计时
				}else{
					showToast(res.res.ReType,res.res.Msg);//消息提示
				}
				
			})
		},

		/**
		 * 根据医嘱组号获取 患者信息
		 * idMedord 医嘱组号
		 */
		getPatientByIdMedord(idMedord){
			let params = {
				orgId: this.loginUser?.JGID,
				jzlx: null,
				lspb: 0,
				yhdm: this.loginUser?.YHDM,
				type: 1, //：病人列表   2：我的关注
				hisJzxh: this.nowPatient.hisJzxh,//病人就诊流水号
				idMedord:idMedord,
			};
			return this.$commonAjax(
				"auth/mobile/patient/get/getPatientList",
				params
			)
		},

		//过滤 未完成/已完成
		handleExecuteFilter(){
			this.executeFilter = this.executeFilter == 2?1:2;
			this.getSkinListByMzhm(this.nowPatient.mzhm);//刷新数据
		},
		//二次核对提交
        async handleDoubleCheckSubmit(){
			console.log('皮试录入',this.doubleCheckForm);
			// let params={
			// 	yhdm: this.doubleCheckForm.userName,
			// 	pwd: this.doubleCheckForm.password,// 输入 noPwd 时测试用 不走密码验证
			// 	jgid: this.loginUser.JGID,
			// }
			// let result = await this.$commonAjaxGet("/mobile/user/checkUser", params);
			// if (result.res.ReType == 0) {
				// if(result.res.Data.YHID == this.loginUser.YHID){
				// 	showToast(-1,'请更换护士进行二次核对')
				// 	return;
				// }
			// this.doubleCheckForm.userId = result.res.Data.YHID;
			this.handleSkinTestResultSubmit();//调用接口
			// } else {
				// showToast(-1,'用户验证失败')
				// return;
			// }
        },
		//录入结果弹窗点击关闭
        handleDoubleCheckClose(){
            this.showDoubleCheck = false;
			this.doubleCheckForm = {
				userName:null,//护士用户名
                password:null,//护士密码
				userId:null,//用户id
				skinResult: null,//皮试结果
			};
        },

		/**
		 * 根据病人id 获取病人详情
		 * brid 病人id
		 */
		getPatientByBrid(brid){
			let params = {
				orgId: this.loginUser?.JGID,//长机构id
				jzlx: null,// 就诊类型 1 抢救 2 留观 3诊室 不传就是全部 
				lspb: 0,//离室判别
				yhdm: this.loginUser?.YHDM,// 当前登录用户的员工代码
				type: 1, //：病人列表   2：我的关注
				// hisJzxh: idVismed,
				// idMedord:idMedord,// 医嘱组号
				brid:brid,//病人id
				
			};
			return this.$commonAjax(
				"auth/mobile/patient/get/getPatientList",
				params
			)
		},

		/**
		 * 根据 就诊流程号 获取病人皮试信息
		 * mzhm 病人病案号
		 */
		getSkinListByMzhm(mzhm) {
			this.listData = [];//置空列表

			let date = new Date();
			let year = date.getFullYear();
			let month = date.getMonth()+1;
			let day = date.getDate();
			let params = {
				// depMedord: this.loginUser.KSID,//开立科室
				// functionId: null,//系统参数
				search: mzhm,//病案号
				timeStart: getTimestamp(new Date(`${year}-${month>9?month:'0'+month}-${day>9?day:'0'+day} 00:00:00.000`)),//开始时间
				timeEnd: getTimestamp(new Date(`${year}-${month>9?month:'0'+month}-${day>9?day:'0'+day} 23:59:59.999`)),//结束时间
				// timeStart: getTimestamp(new Date(`2023-11-30 00:00:00.000`)),//开始时间
				// timeEnd: getTimestamp(new Date(`2023-11-30 23:59:59.999`)),//结束时间
				// "timeStart": 1700668800000,
				// "timeEnd": 1700755199999,
			}

			// let params = {
			// 	"timeStart": 1700668800000,
			// 	"timeEnd": 1700755199999,
			// 	"search":"CSBLH0001366"
			// }

			let url = '';
			if(this.executeFilter == 1){//未皮试
				url = 'auth/mobile/advice/adviceskintest/scanEcisInitSkintestList'
			}else if(this.executeFilter == 2){//已皮试
				url = 'auth/mobile/advice/adviceskintest/scanEcisgetOrdSkintestHistory'
			}

			return this.$commonAjax(
				url,
				params
			).then(res=>{
				console.log('皮试列表',res);
				let data = res.res.Data;
				data.forEach(el=>{
					if(el.dtStartSign){//皮试已扫描
						el['skinTestScaned'] = 1;
					}else{//皮试未扫描
						el['skinTestScaned'] = 0;
					}
					el['dtMedordActiveStr'] = getDateTimeString(el.dtMedordActive);
					el['updateTimeStr'] = getDateTimeString(el.updateTime);

				})
				this.listData = data;
				this.isRefresherTriggered = false;

				
				if(this.executeFilter == 1){//未完成列表
					this.listData.forEach(el=>{
						if(this.skinTestPatientList.find(patient=>patient.idVismed == el.idVismed) == null){//皮试列表中不存在这个患者
							if(el.skinTestScaned == 1){//患者的皮试状态为进行中
								//患者加入皮试队列
								let skinTestPatient =  {
									brxm:this.nowPatient.brxm,//病人姓名
									mzhm:this.nowPatient.mzhm,// 病案号
									idVismed:this.nowPatient.hisJzxh,// 就诊流程号
									idMedord:el.idMedord,// 医嘱组号
									naSrvMed:el.naSrvMed,//药品名称
									quanSkintestLimit:el.quanSkintestLimit,// 皮试时间  分钟
									startTime:el.dtStartSign,// 开始时间  时间戳
									shouldEndTime:el.dtStartSign + Number(el.quanSkintestLimit) * 60 * 1000,// 应当结束的时间  时间戳
									// shouldEndTime:el.dtStartSign + 10 * 1000,// 测试 应当结束的时间  时间戳
								}
								this.$store.commit("addSkinTestPatient", skinTestPatient);
							}
						}
					})
				}
			})
		},

		loginOut() {
			logout()
		},
		onPullRefresh() {
			if (this.isRefresherTriggered) {
				return
			}
			this.isRefresherTriggered = true;
			this.getSkinListByMzhm(this.nowPatient.mzhm);
		},
		onReachBottomDistance() {
			console.log(1111);
		},
	},
}
</script>

<style lang="scss">
.main-context{
	position: relative;
	height: calc(100% - 314rpx);
}
.scan-tips-warning {
	text-align: center;
	background-color: #faefe4;
	font-size: 30rpx;
	color: #ff9a27;
	padding: 10rpx 0rpx;
}
.scan-tips-primary {
	text-align: center;
	background-color: #4089fe1f;
	font-size: 30rpx;
	color: #4088FE ;
	padding: 10rpx 0rpx;
}
.bar-area {
	height: 100rpx;
	background-color: $bs-color-primary;
	display: flex;
	flex-direction: row;
	align-items: center;
	font-size: 30rpx;
	justify-content: space-between;
	padding: 0 30rpx;
}
.scroll-view {
	width: 100%;
	height: calc(100% - 26rpx);
	background-color: #f3f5f7;
	padding-bottom: 20rpx;
}
.patient-info{
    padding: 20rpx;
	position: relative;

	.filter-button{
		font-size: 28rpx;
		color: #4088FE;
		background-color: #EBF3FE;
		border: 2rpx solid #4088FE;
		border-radius: 6rpx;
		width: 100rpx;
		text-align: center;
		padding: 10rpx 10rpx;
		position: absolute;
		right: 20rpx;
		top: 14rpx;
		z-index: 100;
	}
}
.item-area {
	position: relative;
	margin: 20rpx 20rpx 0 20rpx;
	background-color: #ffff;
	border-radius: 10rpx;
	padding: 10rpx;
	.isExecute{
		position: absolute;
		right: -30rpx;
		top: 0rpx;
		width: 0rpx;
		height: 0rpx;
		border-right: 50rpx solid transparent;
		border-left: 50rpx solid transparent;
		border-bottom: 50rpx solid #26BF40;
		transform: rotate(45deg);
		.my-icon{
			position: relative;
			right: 10rpx;
			top: 24rpx;
			font-weight: bold;
			-webkit-transform: rotate(-45deg);
			transform: rotate(-45deg);
			color: #FFFFFF;
		}
	}
}
.item-title {
	padding: 6rpx 10rpx 12rpx 10rpx;
	display: flex;
}
.item-line{
	width: 1rpx;
	background-color: #d6d7d9;
	height: 46rpx;
	width: 2rpx;
}

.item-body {
	display: flex;
	flex-direction: column;
	justify-content: center;
	padding: 0 20rpx;
}
.item-body-top {
	display: flex;
	flex-direction: row;
	align-items: center;
	margin-bottom: 10rpx;
}
.item-check-status{
	font-size: 27rpx;
	margin-left: auto;
	margin-right: 10rpx;
	font-weight: bold;
	color: #4088FE;
}

.item-brch {
	width: 98rpx;
	font-size: 30rpx;
	color: #e06263;
	font-weight: bold;
}
.item-info{
    display: flex;
}

.item-content{
	font-size: 28rpx;
	padding: 10rpx 10rpx 4rpx 10rpx;
	display: flex;
    border-bottom: 1px solid #E9E9EB;
    position: relative;
	.item-content-icon{
		font-size:25rpx;
		padding: 4rpx 8rpx;
		border-radius: 8rpx;
		background-color: #fff5ea;
		color: #ff9a27;
		width: 28rpx;
		height: 37rpx;
		margin-right: 10rpx;
	}
	.item-content-list{
		padding: 6rpx 8rpx;
		.list-item{
			display: flex;
			margin-bottom: 6rpx;
			max-width: 480rpx;
			.item-name{
				color: #262626;
				margin-right: 20rpx;
			}
			.item-amount{
				color: #262626;
				color: #4088FE;
			}
		}
	}
    .item-usage{
        background-color: #F0F3F6;
        border-radius: 8rpx;
        padding: 4rpx 16rpx;
        height: 35rpx;
        font-size: 25rpx;
        position: absolute;
        bottom: 15rpx;
        right: 10rpx;
    }
	.item-check-yes{
		display: flex;
		align-items: center;
		justify-content: space-between;
		padding: 8rpx 15rpx;
		border-radius: 8rpx;
		background-color: #26bf4017;
        margin-bottom: 10rpx;
    	margin-left: auto;
	}
	
}
.check-datetime{
	font-size: 25rpx;
	color: #909399;
	padding: 0rpx 12rpx 8rpx 12rpx;
}
.item-bottom{
    display: flex;
    align-items: center;
    margin-top: 10rpx;
    .plan-datetime{
        font-size: 25rpx;
        color: #909399;
        padding: 0rpx 12rpx 8rpx 12rpx;
    }
}

.patientInfo-zd{
    width: calc(100% - 100rpx);
    font-size: 25rpx;
	color: #909399;
	padding: 0rpx 12rpx 8rpx 12rpx;
    position: relative;
    left: 116rpx;
}
.double-check{
    height: 600rpx;
    position: relative;
    padding: 20rpx;
    .double-check-title{
        font-size: 34rpx;
        text-align: center;
        margin-bottom: 30rpx;
    }
    .double-check-form-item{
        display: flex;
        align-items: baseline;
        margin-bottom: 20rpx;
        .double-check-form-item-label{
            font-size: 32rpx;
            width: 240rpx;
        }
        .double-check-form-item-input{
            .u-input{
                background-color: #F9F9F9;
                width: 460rpx;
            }
        }
		.u-radio{
			margin-bottom: 40rpx !important;
		}
    }
    .submit-button{
        bottom: 10px;
        text-align: center;
        button{
            color: #FFFFFF;
            background-color: #4088FE;
            width: calc(100% - 20rpx);
            position: absolute;
            bottom: 0px;
            
        }
    }
}

</style>
